package com.lyb.ui.authentication.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DatabaseHelper extends SQLiteOpenHelper {

    private static DatabaseHelper instance;
    private static String DBName = "lyb.db";

    private static int    tabVersion  = 1;
    public static  String TAB_CONTACT = "ContactTab";

    private String creatTabSql = "CREATE TABLE " + TAB_CONTACT + " (ID INTEGER, MOBILENUM VARCHAR, NAME " +
            "VARCHAR,STATUS INTEGER,USER_ID VARCHAR)";

    public static DatabaseHelper getInstance(Context context) {
        if (instance == null) {
            instance = new DatabaseHelper(context);
        }
        return instance;
    }

    DatabaseHelper(Context context) {
        super(context, DBName, null, tabVersion);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(creatTabSql);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // TODO Auto-generated method stub
        db.execSQL(creatTabSql);
        onCreate(db);
    }

}
